package cn.edu.sgu.www.mhxysy.service.repository.impl;

import cn.edu.sgu.www.mhxysy.entity.repository.RepositoryGrid;
import cn.edu.sgu.www.mhxysy.mapper.repository.RepositoryGridMapper;
import cn.edu.sgu.www.mhxysy.service.repository.RepositoryGridService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Service
public class RepositoryGridServiceImpl implements RepositoryGridService {

    private final RepositoryGridMapper repositoryGridMapper;

    @Autowired
    public RepositoryGridServiceImpl(RepositoryGridMapper repositoryGridMapper) {
        this.repositoryGridMapper = repositoryGridMapper;
    }

    @Override
    public List<RepositoryGrid> selectByRepositoryId(String repositoryId) {
        QueryWrapper<RepositoryGrid> queryWrapper = new QueryWrapper<>();

        queryWrapper.eq("repository_id", repositoryId);
        queryWrapper.orderByAsc("location");

        return repositoryGridMapper.selectList(queryWrapper);
    }

}